<template>
  <a-card :bordered='false'>
    <a-col :span='18'>
      <a-spin tip='Loading...' :spinning='spinning'>
        <div>
          <a-row>
            <a-col :span='18'>
              <p>
                <a-divider orientation='left'>----手工调用接口</a-divider>
              </p>
            </a-col>
            <a-col :span='6'></a-col>
            <!-- 预览区域 -->
            <a-col :span='12'>
              <template>
                <div style='float: left;width:104px;height:104px;margin-right: 10px;margin: 0 8px 8px 0;'>
                  <a-button type='primary' :loading='isLoading1' @click='saveRelDateWeek'>获取节假日数据</a-button>
                </div>
              </template>
            </a-col>
            <a-col :span='12'>
              <template>
                <div style='float: left;width:104px;height:104px;margin-right: 10px;margin: 0 8px 8px 0;'>
                  <j-upload bizPath='ora/school/text' fileType='all' v-model='fileUrl' :number='num'></j-upload>
                </div>
              </template>
            </a-col>
          </a-row>
        </div>
      </a-spin>
      <p></p>
    </a-col>
  </a-card>
</template>

<script>

import ARow from 'ant-design-vue/es/grid/Row'
import { postAction, getAction } from '@api/manage'

export default {
  name: 'ImagPreview',
  components: {
    ARow
  },
  data() {
    return {
      description: '图片预览页面',
      spinning: false,
      isLoading1: false,
      isLoading2: false,
      num: 3,
      fileUrl: [],
      //数据集
      dataSource: [],
      url: {
        saveRelDateWeek: '/reldateweek/saveRelDateWeek',
        runTeachingJobExecute: '/couteachingjobexecute/couTeachingJobExecute/runTeachingJobExecute'
      }
    }
  },

  created() {
  },
  methods: {
    saveRelDateWeek: function() {
      this.isLoading1 = true;
      postAction(this.url.saveRelDateWeek, { 'years': 2022 }).then(res => {
        /**
         *  ES5 比较两个值是否相等，只有两个运算符：相等运算符== 和严格相等运算符===。它们都有缺点，
         *  前者会自动转换数据类型，后者的NaN不等于自身，以及+0等于-0。Object.is()则保证最严格的相等。
         */
        if (res.code === 200) {
          this.$message.success(res.message);
        } else {
          this.$message.error(res.message);
        }
        this.isLoading1 = false
      });
    },
    runTeachingJobExecute: function(){
      this.isLoading2 = true;
      postAction(this.url.runTeachingJobExecute,{"coursePlanId":"1011497146481463435265","targetObjId":"1011497151580239732738","courseArrangeId":"1646218831422"}).then(res => {
        if(res.code === 200 ){
           this.$message.success(res.message);
        }else {
          this.$message.error(res.message);
        }
        this.isLoading2 = false;
      });
    }
  }
}
</script>
<style scoped>
.table-operator {
  margin-bottom: 10px
}

.clName .ant-tree li span.ant-tree-switcher, .ant-tree li span.ant-tree-iconEle {
  width: 10px !important;
}

.clName .ant-tree li .ant-tree-node-content-wrapper.ant-tree-node-selected {
  background-color: #1890FF !important;
}
</style>